﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.Utilities;
using Model;
using BLL;

public partial class Platform_WashPriceModify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataShow();
        }
    }
    private void DataShow()
    {
        WashPirce Model = WashPirceService.GetWashPirceById(Convert.ToInt32(Request.QueryString["ID"]));
        if (Model != null)
        {
            txtProject.Text = Model.Project;
            txtPirce.Text = Model.Pirce.ToString();
            txtTimes.Text = Model.Times.ToString();
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        WashPirce Model = WashPirceService.GetWashPirceById(Convert.ToInt32(Request.QueryString["ID"]));
        if (Model != null)
        {
            Model.Project = txtProject.Text.Trim();
            Model.Pirce = decimal.Parse(txtPirce.Text.Trim());
            Model.Times = int.Parse(txtTimes.Text.Trim());

            if (WashPirceService.UpdateWashPirceById(Model) > 0)
            {
               MessageBox.AppendScript(this, "$(':input[id$=\"btnBindData\"]', window.parent.document.body).click();");
            }
            else
            {
                MessageBox.ShowSaveError(this);
            }
        }
    }
}